package com.yidiandao.business.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 活动订单
 * <p>
 * Created by SunDing(dindding@163.com) on 2017/4/21 10:22
 */
public class ActiveOrderAdapter extends FragmentPagerAdapter {
    List<Fragment> list_fragment = new ArrayList<>();
    private String[] mTitles;

    public ActiveOrderAdapter(FragmentManager fm, String[] titles) {
        super(fm);
        mTitles = titles;
        list_fragment.clear();
    }

    @Override
    public Fragment getItem(int position) {
        return list_fragment.get(position);
    }

    @Override
    public int getCount() {
        return list_fragment.size();
    }

    public void addFragment(Fragment fragment) {
        list_fragment.add(fragment);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
